package com.cheney.diandireader.server.webservice;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cheney.diandireader.server.vo.Book;
import com.cheney.diandireader.server.vo.BookCategory;

@Controller
@RequestMapping("/bookWebService")
public class BookWebService {

	//return the book category
	@RequestMapping("/bookCategory.json")
	@ResponseBody
	public Object listBookCategory(){
		List<BookCategory> list = new ArrayList<BookCategory>();
		BookCategory book1 = new BookCategory();
		book1.setId("001");
		book1.setName("历史");
		list.add(book1);
		BookCategory book2 = new BookCategory();
		book2.setId("002");
		book2.setName("军事");
		list.add(book2);
		BookCategory book3 = new BookCategory();
		book3.setId("003");
		book3.setName("玄幻");
		list.add(book3);
		return list;
	}
	
	//return the book of this category
	@RequestMapping("/bookByCategory.json")
	@ResponseBody
	public Object listBookByCategory(){
		List<Book> list = new ArrayList<Book>();
		Book book1 = new Book();
		book1.setId("001");
		book1.setName("明朝那些事");
		list.add(book1);
		Book book2 = new Book();
		book2.setId("002");
		book2.setName("盗墓笔记");
		list.add(book2);
		Book book3 = new Book();
		book3.setId("002");
		book3.setName("地心历险记");
		list.add(book3);
		return list;
	}
	//list best book
	@RequestMapping("/bookOfBest.json")
	@ResponseBody
	public Object listBookOfBest(){
		List<Book> list = new ArrayList<Book>();
		Book book1 = new Book();
		book1.setId("001");
		book1.setName("明朝那些事");
		list.add(book1);
		Book book2 = new Book();
		book2.setId("002");
		book2.setName("盗墓笔记");
		list.add(book2);
		Book book3 = new Book();
		book3.setId("002");
		book3.setName("地心历险记");
		list.add(book3);
		list.add(book3);
		list.add(book3);
		list.add(book3);
		list.add(book3);
		list.add(book3);
		list.add(book3);
		list.add(book3);
		list.add(book3);
		list.add(book3);
		list.add(book3);
		return list;
	}
	
	//list the book which be read most
	@RequestMapping("/bookMostRead.json")
	@ResponseBody
	public Object listBookMostRead(){
		List<Book> list = new ArrayList<Book>();
		Book book1 = new Book();
		book1.setId("001");
		book1.setName("明朝那些事");
		list.add(book1);
		Book book2 = new Book();
		book2.setId("002");
		book2.setName("盗墓笔记");
		list.add(book2);
		Book book3 = new Book();
		book3.setId("002");
		book3.setName("地心历险记");
		list.add(book3);
		return list;
	}
	
}
